﻿@model SendPrivateMessageModel
@using SmartStore.Web;
@using SmartStore.Web.Models.PrivateMessages;
@{    
    Layout = "_Layout";
    Html.AddTitleParts(T("PageTitle.SendPM").Text);
}

@using (Html.BeginForm())
{
    <div class="page private-message-send-page">
        <div class="page-title">
            <h2>@T("PrivateMessages.Send.PostMessage")</h2>
        </div>
        
        <div class="page-body">
            <div class="message-error">
                @Html.ValidationSummary(true)
            </div>
            @Html.HiddenFor(model => model.ToCustomerId)
            @Html.HiddenFor(model => model.ReplyToMessageId)

            <div class="form-group row">
                <label class="col-sm-3">@T("PrivateMessages.Send.To")</label>
                <div class="col-sm-9">
                    @if (Model.AllowViewingToProfile)
                    {
                        <a href="@Url.RouteUrl("CustomerProfile", new { id = Model.ToCustomerId })" rel="nofollow">@(Model.CustomerToName)</a>
                    }
                    else
                    {
                        @Model.CustomerToName
                    }
                </div>
            </div>

            <div class="form-group row">
                <label class="col-sm-3">@T("PrivateMessages.Send.Subject")</label>
                <div class="col-sm-9">
                    @Html.TextBoxFor(model => model.Subject, new { @class = "pm-title-text form-control" })
                    @Html.ValidationMessageFor(model => model.Subject)
                </div>
            </div>

            <div class="form-group row">
                <label class="col-sm-3">@T("PrivateMessages.Send.Message")</label>
                <div class="col-sm-9">
                    @Html.BBCodeEditor("Message")
                    @Html.TextAreaFor(model => model.Message, new { @class = "bb-editor-text form-control", TextMode = "MultiLine" })
                    @Html.ValidationMessageFor(model => model.Message)
                </div>
            </div>

            <div class="row justify-content-end">
                <div class="col-sm-9 mt-3">
                    <button type="submit" class="btn btn-primary">
                        <span>@T("PrivateMessages.Send.SendButton")</span>
                    </button>
                    <button class="btn btn-secondary" onclick="setLocation('@Url.RouteUrl("PrivateMessages", new { tab = "inbox" })')">
                        <span>@T("PrivateMessages.Send.CancelButton")</span>
                    </button>
                </div>
            </div>
        </div>
    </div>
}